package come.bjpowernode.javase.reflect;

import come.bjpowernode.javase.reflect.bin.User;

import java.lang.reflect.Field;

public class ReflectTestGetFieldTest {
    public static void main(String[] args) throws Exception {
//        Class<?> aClass = Class.forName("F:\\postgraduate\\ana_start\\Java\\IDEA\\javase\\reflect\\src\\come\\bjpowernode\\javase\\reflect\\bin\\User.java");
        User user = new User();
        user.setAge(20);

        /*System.out.println(User.class);
        System.out.println(user.getClass());*/
        Class<? extends User> aClass = user.getClass();
        for (Field declaredField : aClass.getDeclaredFields()) {
            declaredField.setAccessible(true);
            Object o =  declaredField.get(user);
            System.out.println(o);
        }
    }
}
